home *** CD-ROM | disk | FTP | other *** search
- Path: bignews.shef.ac.uk!usenet
- From: Saul Cozens <s.cozens@sheffield.ac.uk>
- Newsgroups: comp.lang.c++
- Subject: Re: pointer questions
- Date: Sat, 23 Mar 1996 10:34:28 +0000
- Organization: University of Sheffield, UK
- Message-ID: <3153D3B4.41C67EA6@sheffield.ac.uk>
- References: <4ifatf$5a8u@uvaix3e1.comp.UVic.CA> <4ifuv3$bf6@masala.cc.uh.edu>
- NNTP-Posting-Host: spike.shef.ac.uk
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.4 sun4m)
-
- Sensarn wrote:
- >
- > cgesy@uvaix.uvic.ca (Colin Gesy) wrote:
- > >Could someone tell me if there is a difference
- > >between the declaration "int *thing_ptr" and
- > >"int* thing_ptr" ?
- >
- > Not that I know of...
- >
-
- The only difference that I can think of is one of style -
- I always thought that using
- int* thing_ptr;
-
- is potentially dangerous when declaring multiple pointers -
- int* thing_ptr, another_ptr;
-
- This looks (at first glance) that thing_ptr and another_ptr are
- both integer pointers - this is NOT the case - another_ptr
- has, of course, been declared as an integer.
-
- Group the '*' with the variable name rather than the type
- reduces this confusion -
-
- int *thing_ptr, *another_ptr;
-
- Pedantic I know - but programming style IS important.
-
- Saul
- ==============================================================
- email: mailto:s.cozens@sheffield.ac.uk
- WWW: http://www.shef.ac.uk/~eee/esg/staff/suc_prof.html
- tel. work: +44 (0)114 282 5188
- tel. home: +44 (0)114 268 0385
-